#include"personTree.h"

int main()
{
    Employee employee(0, "Tom", "male", "会计师");
    Teacher teacher(1, "Andy", "female", "数学");
    Student student(2, "Job", "male", 3);

    PersonTree myTree;

    // 插入
    cout << "异质树插入" << endl;
    myTree.InsertTree(&teacher);
    myTree.InsertTree(&employee);
    myTree.InsertTree(&student);

    // 遍历
    cout << "异质树遍历" << endl;
    myTree.InOder(myTree.GetRoot());
 
    // 查找
    cout << "异质树查找" << endl;
    myTree.Find(0);
    myTree.Find(1);
    myTree.Find(2);

    // 删除
    cout << "异质树删除" << endl;
    myTree.Delete(1);
    myTree.InOder(myTree.GetRoot());
    myTree.Delete(2);
    myTree.InOder(myTree.GetRoot());
    myTree.Delete(0);
    myTree.InOder(myTree.GetRoot());

    return 0;
}
